<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>

        // ws://121.40.165.18:8800
        const url = 'ws://172.31.12.110:8888/webSocket/123';
        const webs = new WebSocket(url);
        webs.onopen = (res) => {
            console.log(res);
            webs.send("hello websocket");
        };
        webs.onerror = (err) => {
            console.error(err);
        }

        webs.onmessage = (message) => {
            console.log(' on message = ', message)
        }
    </script>
</body>

</html>